---
title: "How to stream Postgres to Redis Streams"
sidebarTitle: "Redis Stream"
description: "Create real-time data pipelines with Redis Streams and Postgres change data capture (CDC). Stream database changes for caching, analytics, and event distribution."
---

This guide shows you how to set up Postgres change data capture (CDC) and `XADD` changes to a Redis stream using Sequin.

With Postgres data streaming to Redis, you can trigger workflows, keep services in sync, [build audit logs](/how-to/create-audit-logs), [maintain caches](/how-to/maintain-caches), and more.

By the end of this how-to, you'll have database changes flowing to a Redis stream.

<Tip>
  This is the how-to guide for streaming Postgres to Redis Streams. See the [quickstart](/quickstart/redis-stream) for a step-by-step walkthrough or the [reference](/reference/sinks/redis-stream) for details on all configuration options.
</Tip>

## Prerequisites

If you're self-hosting Sequin, you'll need:

1. [Sequin installed](/running-sequin)
2. [A database connected](/connect-postgres)
3. A Redis instance ready to go



## Create Redis Stream sink

Navigate to the "Sinks" tab, click "Create Sink", and select "Redis Stream Sink".

### Configure the source

<Steps>
  <Step title="Select source tables">
    Under "Source", select the schemas and tables you want to stream data from.
  </Step>

  <Step title="Add filters (optional)">
    Add [filters](/reference/filters) to the sink to control which database changes are sent to your Redis stream.
  </Step>

  <Step title="Add transform (optional)">
    Add a [transform](/reference/transforms) to the sink to modify the payload before it's sent to Redis.
  </Step>

  <Step title="Specify backfill">
    You can optionally indicate if you want Redis to receive a [backfill](reference/backfills) of all or a portion of the table's existing data. Backfills are useful if you want to use Redis to process historical data.

    You can backfill at any time. If you don't want to backfill, toggle "Backfill" off.
  </Step>

  <Step title="Specify message grouping">
    Under "Message grouping", you'll most likely want to leave the default option selected to ensure events for the same row are sent to Redis in order.
  </Step>

</Steps>

### Configure Redis Stream

<Steps>
  <Step title="Enter Redis connection details">
    Fill in your Redis connection details:

    - **Host** (required): The hostname of your Redis server
    - **Port** (required): The port number (1-65535)
    - **Stream key** (required): The name of the stream where messages will be published (max 255 characters)
    - **Username**: Redis username for authentication (optional)
    - **Password**: Redis password for authentication (optional)
    - **Database**: Redis database number (optional, defaults to 0)
    - **TLS**: Enable TLS/SSL encryption for the connection (optional, defaults to false)
  </Step>

  <Step title="Create the sink">
    Give your sink a name, then click "Create Redis Stream Sink".
  </Step>
</Steps>

## Verify & debug

To verify that your Redis Stream sink is working:

1. Make some changes in your source table
2. Verify that the count of messages for your sink increases in the Sequin web console
3. Using Redis CLI or another Redis client, check your stream:
   ```bash
   xread count 10 streams your-stream-key 0
   ```
   You should see the messages from Sequin appear in the stream.

If messages don't seem to be flowing:

1. Click the "Messages" tab to view the state of messages for your sink
2. Click any failed message
3. Check the delivery logs for error details, including any Redis connection errors

## Next steps

- **Setup a processor**

   Now that your Postgres data is flowing into Redis, you can setup a processor to read from the stream and process the data. See the Redis docs on [`XREAD`](https://redis.io/docs/latest/commands/xread/).

   Refer to the [Redis Stream sink reference](/reference/sinks/redis-stream) for the shape of messages that Sequin will publish to Redis.

- **Deploy your implementation**

   When you're ready to deploy your implementation, see "[How to deploy to production](/how-to/deploy-to-production)".

- **Advanced configuration**

   For more about how Redis Stream sinks work, see the [Redis Stream sink reference](/reference/sinks/redis-stream).
